package com.biboheart.adapter.express.support;

import com.biboheart.adapter.express.operation.Calculate;
import com.biboheart.adapter.support.utils.ObjectTypeUtils;

final class BitRightCalculate implements Calculate<Number, Number, Integer> {
    @Override
    public Number calc(Number left, Integer right) {
        if (null == left) {
            left = 0;
        }
        if (null == right) {
            return left;
        }
        if (left instanceof Long) {
            return ObjectTypeUtils.convertType(left, Long.class) >> right;
        }
        return ObjectTypeUtils.convertType(left, Integer.class) >> right;
    }

    @Override
    public Number calc(Number num) {
        return null;
    }
}
